]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dash: Revert mislead cleanup
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 3 Oct 2015 21:44:48 +0000 (23:44 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 13 Oct 2015 18:21:44 +0000 (20:21 +0200)
When adjusting dash icon sizes, we compute the icon padding by subtracting
the configured icon size from the first icon actor's preferred size. To
make sure that the preferred size correctly corresponds to the current
dash icon size even while the icon is animating, we enforce the size
before the size request. For that we used to temporarily manipulate
the icon texture size directly, but commit e92d204d425 cleaned this
up to use the setIconSize() method instead.
This does not work however, as the icon actor's iconSize property will
always match the dash iconSize property, making the method a noop. So
go back to the original approach of enforcing the texture size to make
sure we always base our computations on correct values.

https://bugzilla.gnome.org/show_bug.cgi?id=745649

js/ui/dash.js

index 246bc108bdf1c05f118355b0bdf9ffc1369c0b2f..e809f87ab329a2f76642e4b798a0041dd17db283 100644 (file)
@@ -644,15 +644,13 @@ const Dash = new Lang.Class({
         let firstIcon = firstButton._delegate.icon;
 
         let minHeight, natHeight;
+        let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
 
         // Enforce the current icon size during the size request
-        firstIcon.setIconSize(this.iconSize);
+        let [currentWidth, currentHeight] = firstIcon.icon.get_size();
+        firstIcon.icon.set_size(this.iconSize * scaleFactor, this.iconSize * scaleFactor);
         [minHeight, natHeight] = firstButton.get_preferred_height(-1);
-
-        let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
-        let iconSizes = baseIconSizes.map(function(s) {
-            return s * scaleFactor;
-        });
+        firstIcon.icon.set_size(currentWidth, currentHeight);
 
         // Subtract icon padding and box spacing from the available height
         availHeight -= iconChildren.length * (natHeight - this.iconSize * scaleFactor) +
@@ -660,6 +658,10 @@ const Dash = new Lang.Class({
 
         let availSize = availHeight / iconChildren.length;
 
+        let iconSizes = baseIconSizes.map(function(s) {
+            return s * scaleFactor;
+        });
+
         let newIconSize = baseIconSizes[0];
         for (let i = 0; i < iconSizes.length; i++) {
             if (iconSizes[i] < availSize)